home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1997: The Complete Utilities Toolkit / macworld-complete-utilities-1997.iso / Programming / Little Smalltalk v3.1.5 / Smalltalk Source / tclwin.st < prev    next >
Encoding:
Text File  |  1995-07-03  |  33.6 KB  |  1,391 lines  |  [TEXT/KAHL]

  1. * ***
  2. * tclwin.st
  3. *
  4. * Classes to create and control the windowing interface
  5. *
  6. * Julian Barkway (c) September 1994 All rights reserved. 
  7. *
  8. * (Based on stdwin.st by Timothy Budd)
  9. *
  10. * v3.1.0 - Initial release
  11. * v3.1.1 - Changed to ensure correct system menu highlighting 
  12. *           when no windows are open.
  13. * v3.1.2 - No longer crashes when 'printer print:' invoked with no Workspace.
  14. *         - Changed to allow the Workspace window to be restored after 
  15. *          being closed.
  16. *        - Pixel line length can now be specified for text-based panes.
  17. *        - Sundry tidying-up of code.
  18. * v3.1.3 - Pop-up menu objects removed from global menus array. Global added to 
  19. *          track pop-up menu numbers.
  20. *        - Added Smalltalk: getVersion to return the version number as a string.
  21. *        - Menus now referred to by direct pointers to their internal representation
  22. *          instead of array indices.
  23. * v3.1.5 - Added pop-up menu for Workspace window
  24. *        - 'Inspect it' added to System menu.
  25. *        - Windows can be non-closeable.
  26. *        - Multiple workspaces supported; opening a text file automatically creates
  27. *          a new workspace for the file; original workspace is now a non-closeable 
  28. *          'system transcript' window.
  29. *        - Command-key equivalents supported in menus.
  30. *        - Menus now support method selectors as well as blocks for the 'action:' parameter.
  31. *        - Panes now support method selectors in place of blocks for mouse actions.
  32. *        - Pane now directly supports pop-up menus (to use: override Pane>>createPopUpMenu,
  33. *          place the method selectors you wish to use as symbols in your menu definition
  34. *          then set the menu's owner to the object defining these selectors).
  35. *        - Panes now have 'parent' as an instance variable to assist in inter-pane co-ordination
  36. *          for objects that have more than one pane. (To use: set the pane's parent to the 
  37. *          co-ordinating object and use it to route inter-pane message sends). 
  38. *        - SelectListPane now supports an assignable source Collection and protocol to support:
  39. *            • sending a message to the selected item
  40. *            • sending a message to another object with the selected item as a parameter
  41. *            • evaluating a block with the selected item as a parameter.
  42. * ***
  43. Class UserInterface Object saveWS nextItemNumber itemList        " - changed for v3.1.2 "
  44. Class Window Object number title menus size position panes paneNumber mainPane  goAwayBoxPresent
  45. Class     WorkspaceWindow Window           " - class added for v3.1.2 - changed for v3.1.5"
  46. Class        SystemTranscriptWindow WorkspaceWindow
  47. Class WindowPane Object panePtr number type lineLength parentWindow bounds sizing b1Action b2Action b1DoubleClick owner parent pMenu
  48. Class    TextPane WindowPane text fontName fontSize typeFace selectRange file
  49. Class          SelectListPane TextPane selection collection
  50. Class    GraphicsPane WindowPane
  51. Class EventManager Process responses
  52. Class Menu Object menuPtr number title itemtitles items enablestatus numItems shortcuts owner
  53. Class     PopUpMenu Menu
  54. Class Cursor Object cursPtr
  55.  
  56. *
  57. * Dictionary and List methods added for v3.1.5 to support SelectListPanes
  58. *
  59. Methods Dictionary 'enumerating'
  60.     printString 
  61.     | s |
  62.         s <- self class printString , ' ('.
  63.         self binaryDo: [:x :y | s <- s , (x printString) , ' -> ', 
  64.                     (y printString) , newLine ].
  65.         s <- s , ')'.
  66.         ^ s
  67. |
  68.     asFormattedText
  69.     " Return ourselves as a formatted list of key values "
  70.     | txt |
  71.         txt <- ''.
  72.         self binaryDo: [:a :b |
  73.             txt <- txt , (a asString) , newLine
  74.         ].
  75.         ^ txt
  76. |
  77.     findText: theText
  78.     " Match theText to a key and return the associated object "
  79.     | sym |
  80.         sym <- theText asSymbol.
  81.         self binaryDo: [:a :b |
  82.             (sym = a) ifTrue: [
  83.                 ^ b 
  84.             ]
  85.         ].
  86. ]
  87.  
  88. Methods List 'enumerating'
  89.     newDo: aBlock
  90.     | aLink |
  91.     " For each link, perform aBlock using the link as an argument "
  92.     aLink <- links.
  93.     [ aLink notNil ] whileTrue: [
  94.         aBlock value: aLink.
  95.         aLink <- aLink next
  96.     ]
  97. |
  98.     asFormattedText 
  99.     " Return ourselves as a formatted list of key values "
  100.     | txt |
  101.         txt <- ''.
  102.         (self links) binaryDo: [:k :v |
  103.             txt <- txt , k , newLine
  104.         ].
  105.         ^ txt
  106. |
  107.     findText: theText
  108.         ^ self links at: theText ifAbsent: [ ^ nil ].
  109. ]
  110.  
  111. Methods List 'assigning'
  112.     links: aLink
  113.         links <- aLink
  114. |
  115.     addFirstLink: aLink
  116.         (links notNil) ifTrue: [
  117.             aLink link: links.
  118.             links <- aLink
  119.         ]
  120.         ifFalse: [
  121.             aLink link: nil.
  122.             links   <- aLink.
  123.             listEnd <- links
  124.         ]
  125. |
  126.     addLastLink: aLink
  127.         (links isNil)
  128.             ifTrue: [ self addFirstLink: aLink ]
  129.             ifFalse: [
  130.                 listEnd link: aLink.
  131.                 listEnd <- listEnd next 
  132.             ]
  133. ]
  134.  
  135. Methods Link 'accessing'
  136.     key
  137.         ^ key
  138. ]
  139.  
  140. Methods Window 'all'
  141.     new
  142.         title      <- ''.
  143.         menus      <- List new.
  144.         panes      <- Array new: 15.
  145.         paneNumber <- 0.
  146.         goAwayBoxPresent <- true.          "Line added for v3.1.5"
  147.         ^ self allocateSlot
  148. |
  149.     allocateSlot
  150.         " Allocate a slot in the 'windows' global array. Moved out of 'new'
  151.           to allow standalone access for v3.1.2 "
  152.         (1 to: 15) do: [:i | (windows at: i) isNil
  153.             ifTrue: [ windows at: i put: self.
  154.                     number <- i.  ^ self ] 
  155.         ]
  156. |
  157.     attachPane: pane
  158.         paneNumber <- paneNumber + 1.
  159.         panes at: paneNumber put: pane.
  160.         mainPane <- pane.
  161.         ^ paneNumber
  162. |
  163.     attachMenu: menu
  164.         menus addLast: menu.
  165.         <162 number 2 (menu menuPtr)>
  166. |
  167.     detachMenu: menu
  168.         <162 number 3 (menu menuPtr)>
  169. |
  170.     activate
  171.         activeWindow <- self
  172. |
  173.     deactivate
  174.         ^ nil
  175. |
  176.     mainPane
  177.         ^ mainPane
  178. |
  179.     panes
  180.         ^ panes
  181. |
  182.     drawEvent
  183.     " if no panes, do nothing otherwise let each pane draw itself "
  184.         (paneNumber == 0) ifTrue: [
  185.             ^ nil
  186.         ]
  187.         ifFalse: [
  188.             (1 to: paneNumber) do: [ :i |
  189.                 (panes at: i) draw
  190.             ]
  191.         ]
  192. |
  193.     mouseMoveTo: mouseLocation
  194.         " mouse moved with button down "
  195.         ^ nil
  196. |
  197.     mouseDownAt: mouseLocation button: theButton
  198.     " if no panes, do nothing otherwise let the appropriate pane handle the event "
  199.         (paneNumber == 0) ifTrue: [
  200.             ^ nil
  201.         ]
  202.         ifFalse: [
  203.             (1 to: paneNumber) do: [ :i |
  204.                  ((panes at: i) mouseDownAt: mouseLocation button: theButton) 
  205.                 ifTrue: [
  206.                     ^ nil
  207.                 ]
  208.             ].
  209.             ^ nil
  210.         ]
  211. |
  212.     mouseUpAt: mouseLocation
  213.         " mouse up "
  214.         ^ nil
  215. |
  216.     command: n
  217.         (n = 1) ifTrue: [ self close ]
  218. |
  219.     moved
  220.         position <- <161 number 7>
  221. |
  222.     reSized
  223.         size <- <161 number 6>
  224. |
  225.     position
  226.         ^ position
  227. |
  228.     size
  229.         ^ size
  230. |
  231.     number
  232.         ^ number
  233. |
  234.     title
  235.         ^ title
  236. |
  237.     open
  238.         " open our window, unless already opened "
  239.         <160 number 1 title 0>.
  240.         menus do: [:m | <162 number 2 (m menuPtr)> ].
  241.         userInterface addToWindowsMenu: self.
  242.         self reSized.
  243.         self moved
  244. |
  245.     openAt: aPosition withSize: aSize
  246.         " open our window, unless already opened - changed for v3.1.5"
  247.         <160 number 2 title 0 (aPosition x) (aPosition y) (aSize x) (aSize y) 0>.
  248.         self open
  249. |
  250.     openNoGoAwayWindowAt: aPosition withSize: aSize 
  251.         " open the window without a 'go away' box - added for v3.1.5"
  252.         <160 number 2 title 0 (aPosition x) (aPosition y) (aSize x) (aSize y) 1>.
  253.         self open
  254. |
  255.     select
  256.         <161 number 8>.
  257.         self activate
  258. |
  259.     wantsSave
  260.         ^ <161 number 9>
  261. |
  262.     charTyped: c
  263.         smalltalk beep
  264. |
  265.     title: text
  266.         title <- text.
  267.         <161 number 10 title>
  268. |
  269.     close
  270.         " close up shop "
  271.         <161 number 1>.
  272.         windows at: number put: nil.
  273.         userInterface removeFromWindowsMenu: self
  274. |
  275.     saveState
  276.         " Save the state of system items (i.e. text that has been 
  277.           entered by the user) which are not represented by LSt objects " 
  278.         panes do: [:p | 
  279.             p notNil ifTrue: [ 
  280.                 p saveState
  281.             ] 
  282.         ]
  283. |
  284.     restoreState
  285.         " Restore the state of this window and all its panes 
  286.           after loading a new image file "
  287.         self openAt: position withSize: size.
  288.         panes do: [:p | 
  289.             p notNil ifTrue: [ 
  290.                 p restoreState
  291.             ] 
  292.         ]
  293. ]
  294.  
  295. Methods WorkspaceWindow 'all'                " Class added for v3.1.2, modified for v3.1.5 "
  296.     create
  297.         self create: 'Workspace'
  298. |
  299.     create: windowTitle
  300.     | maxW maxH |
  301.         maxW <- (smalltalk getMaxScreenArea) right.
  302.         maxW <- 500 min: (maxW - 50).
  303.         maxH <- (smalltalk getMaxScreenArea) bottom.
  304.         maxH <- 300 min: (maxH - 50).
  305.         self title: windowTitle;
  306.             openAt: (0@0) withSize: (maxW@maxH). " (0@0) = system places window "
  307.         TextPane new; 
  308.             boundsFrom: (-1 @ -1) to: (size + (1 @ 1));
  309.             owner: self; 
  310.             attachTo: self;
  311.             button2Action: #pMenuSelect:.
  312. |
  313.     pMenuSelect: p
  314.         systemMenu popUpAt: p
  315. "
  316. ""
  317. "" The following two methods are now redundant - v3.1.5
  318. ""    close
  319. ""        self saveState.
  320. ""        userInterface saveWorkspace.
  321. ""        super close.
  322. ""
  323. ""|
  324. ""    restoreWorkspace
  325. ""        self allocateSlot.
  326. ""        self restoreState.
  327. "
  328. ]
  329.  
  330. *
  331. * SystemTranscriptWindow is an ever-present workspace which can't be closed.
  332. *
  333. Methods SystemTranscriptWindow 'all'                " Class added for v3.1.5 "
  334.     create
  335.     | maxW maxH |
  336.         maxW <- (smalltalk getMaxScreenArea) right.
  337.         maxW <- 500 min: (maxW - 50).
  338.         maxH <- (smalltalk getMaxScreenArea) bottom.
  339.         maxH <- 300 min: (maxH - 50).
  340.          self title: 'System Transcript'.
  341.         self openNoGoAwayWindowAt: (0@0) withSize: (maxW@maxH).
  342.         TextPane new; 
  343.             boundsFrom: (-1 @ -1) to: (size + (1 @ 1)); 
  344.             owner: self; 
  345.             button2Action: #showSystemMenuAt:;
  346.             attachTo: self;
  347.             print: 'Welcome to Little Smalltalk ' , (smalltalk getVersion) , 
  348.                     newLine , newLine.
  349. ]
  350.  
  351. Methods WindowPane 'all'
  352.     new
  353.         bounds     <- Rectangle new.
  354.         lineLength <- 0.
  355. |
  356.     initialise                        " Added for v3.1.5 "
  357.         self createPopUpMenu.
  358.         self button2Action: #pMenuSelect:
  359. |
  360.     pMenuSelect: aPoint                " Added for v3.1.5 "
  361.         pMenu notNil ifTrue: [
  362.             pMenu popUpAt: aPoint
  363.         ]
  364. |
  365.     createPopUpMenu                    " Added for v3.1.5 "
  366.     " Overridden by subclasses "
  367.         pMenu <- nil
  368. |
  369.                     " Sizing options: 0 - axis is rigid, 1 - axis is elastic "
  370.     attachTo: aWindow withType: theType andSizing: aPoint
  371.         type    <- theType.
  372.         sizing  <- aPoint.
  373.         panePtr <- < 168 1 (aWindow number) theType 
  374.                         (bounds upperLeft x) 
  375.                         (bounds upperLeft y)
  376.                         (bounds bottomRight x)
  377.                         (bounds bottomRight y) 
  378.                         (aPoint x) (aPoint y) 
  379.                         lineLength >.
  380.         number       <- (aWindow attachPane: self).
  381.         parentWindow <- aWindow.
  382.         self initialise.
  383.         ^ panePtr
  384. |
  385.     boundsFrom: topLeft to: bottomRight
  386.         bounds upperLeft: topLeft.
  387.         bounds bottomRight: bottomRight 
  388. |
  389.     type: theType            " 1 - text, 2 - select, 3 - graphics "
  390.         type <- theType
  391. |
  392.     parent: anObject
  393.     " The pane's parent is the object responsible for this pane and those related to it "
  394.         parent <- anObject
  395. |
  396.     parent
  397.         ^ parent
  398. |
  399.     owner: anObject
  400.     " The pane's owner is the object which defines the pane's menu and mouse-button methods "
  401.         owner <- anObject
  402. |
  403.     activate
  404.         ^ nil
  405. |
  406.     deactivate
  407.         ^ nil
  408. |
  409.     size
  410.         ^ <168 2 panePtr>
  411. |
  412.     position
  413.         ^ nil
  414. |
  415.     reSized
  416.         ^ nil
  417. |
  418.     draw
  419.         ^ nil
  420. |
  421.     mouseDownAt: mouseLocation button: theButton
  422.     " Changed to allow double clicks for v3.1.2 "
  423.         (bounds contains: mouseLocation) ifFalse: [
  424.             ^ false
  425.         ]
  426.         ifTrue: [
  427.             (theButton == 1) ifTrue: [
  428.                 (eventManager isDoubleClick) ifTrue: [
  429.                     (b1DoubleClick notNil) ifTrue: [
  430.                         self privatePerformAction: b1DoubleClick at: mouseLocation
  431.                     ]
  432.                 ]
  433.                 ifFalse: [
  434.                     (b1Action notNil) ifTrue: [
  435.                         self privatePerformAction: b1Action at: mouseLocation                    ]
  436.                 ]
  437.             ].
  438.             (theButton == 2) ifTrue: [
  439.                 (b2Action notNil) ifTrue: [
  440.                     self privatePerformAction: b2Action at: mouseLocation
  441.                 ]
  442.             ].
  443.             ^ true
  444.         ]
  445. |
  446.     privatePerformAction: action at: mouseLocation
  447.     | a |
  448.         a <- Array new: 2;
  449.                  at: 1 put: owner; 
  450.                  at: 2 put: mouseLocation.
  451.         smalltalk perform: action withArguments: a ifError:
  452.             [ smalltalk showMessage: 'Invalid action for mouse button event' ]        
  453. |
  454.     button1Action: aSelector
  455.         b1Action <- aSelector
  456. |
  457.     button1DoubleClick: aSelector
  458.         b1DoubleClick <- aSelector
  459. |
  460.     button2Action: aSelector
  461.         b2Action <- aSelector
  462. |
  463.     saveState
  464.         " Handled by sub-classes "
  465.         ^ nil
  466. |
  467.     restoreState
  468.         " Handled by sub-classes "
  469.         ^ nil
  470. ]
  471.  
  472. Methods TextPane 'all'
  473.     new
  474.         super new.
  475.         file <- nil
  476. |
  477.     isTextPane
  478.         ^ true
  479. |
  480.     file
  481.     "Method added for v3.1.5"
  482.         ^ file
  483. |
  484.                                                         " Added for v3.1.2 "
  485.     attachTo: aWindow withSizing: aPoint andLineLength: anInteger
  486.         lineLength <- anInteger.
  487.         panePtr    <- super attachTo: aWindow withType: 1 andSizing: aPoint.
  488. |
  489.     attachTo: aWindow withSizing: aPoint
  490.         lineLength <- 2000.
  491.         panePtr    <- super attachTo: aWindow withType: 1 andSizing: aPoint.
  492. |
  493.     attachTo: aWindow
  494.         lineLength <- 2000.
  495.         panePtr    <- super attachTo: aWindow withType: 1 andSizing: (1@1).
  496. |
  497.     text
  498.         " read updated text and store it"
  499.         ^ text <- <165 panePtr 1>
  500. |
  501.     selectedText
  502.         " read selected text and store it"
  503.         selectRange <- self getSelectionRange.
  504.         ^ text <- <165 panePtr 2>
  505. |
  506.     replaceAllTextWith: newText
  507.         <165 panePtr 3 newText>
  508. |
  509.     clearAllText
  510.         <165 panePtr 4>
  511. |
  512.     print: text
  513.         <166 panePtr text>
  514. |
  515.     draw
  516.         "redraw pane"
  517.         <168 4 panePtr>.
  518.         <168 3 panePtr>.
  519.         <168 5 panePtr>
  520. |
  521.     saveContentsTo: aFileName withType: aFileType
  522.     | f |
  523.         f <- File new;
  524.             name: aFileName;
  525.             open: 'wb' withType: aFileType.
  526.         watchCursor show.
  527.         <206 panePtr 1 (f number)>.
  528.         f close.
  529.         smalltalk setDefaultCursor
  530. |
  531.     saveContents: fileType        | fname |
  532.     "Functionality moved to UserInterface>>saveText: - v3.1.5"
  533.         ^ nil
  534. "        fname <- smalltalk askNewFile: 'Text file:'.
  535. ""        (fname notNil) ifTrue: [
  536. ""            self saveContentsTo: fname withType: fileType.
  537. ""            ^ true
  538. ""        ]
  539. ""        ifFalse: [
  540. ""            ^ false
  541. ""        ]
  542. "
  543. |
  544.     loadContentsFrom: aFileName | f |
  545.     "Modified for v3.1.5"
  546.         f <- File new;
  547.             name: aFileName;
  548.             open: 'rb'.
  549.         watchCursor show.
  550.         <206 panePtr 0 (f number)>.
  551.         f close.
  552.         smalltalk setDefaultCursor.
  553.         file <- aFileName.
  554. |
  555.     loadContents: fileType        | fname |
  556.     "Functionality moved to UserInterface>>openTextFile: - v3.1.5"
  557.          ^ nil
  558. "        fname <- smalltalk askFile: 'Text file:' withFilter: fileType.
  559. ""        (fname notNil) ifTrue: [
  560. ""            self loadContentsFrom: fname.
  561. ""            ^ true
  562. ""        ]
  563. ""        ifFalse: [
  564. ""            ^ false
  565. ""        ]
  566. "
  567. |
  568.     getSelectionRange
  569.         " Return the current selection range as a point where x = start and y = end
  570.           of range "
  571.         ^ <165 panePtr 9>
  572. |
  573.     setSelectionRangeFrom: startCharPos to: endCharPos
  574.         " set the selection range to the given start and end character positions "
  575.         <165 panePtr 8 startCharPos endCharPos>
  576. |
  577.     scrollToSelection
  578.         " Ensure that the current selection is visible within the text pane"
  579.         <165 panePtr 10>
  580. |
  581.     font: aFontName
  582.         fontName <- aFontName.
  583.         <165 panePtr 5 aFontName>
  584. |
  585.     fontSize: aNumber
  586.         fontSize <- aNumber.
  587.         <165 panePtr 6 aNumber>
  588. |
  589.     typeFace: aNumber    " 1 - plain, 2 - bold, 3 - italic, 4 - underline "
  590.         typeFace <- aNumber.
  591.         <165 panePtr 7 aNumber>
  592. |
  593.     saveState
  594.         self text.
  595.         selectRange <- self getSelectionRange
  596. |
  597.     restoreState
  598.         " Restore the state of this pane after loading a new image file and 
  599.           re-draw any text "
  600.         panePtr <- < 168 1 (parentWindow number) type 
  601.                         (bounds upperLeft x) 
  602.                         (bounds upperLeft y)
  603.                         (bounds bottomRight x)
  604.                         (bounds bottomRight y) 
  605.                         (sizing x) (sizing y) >.
  606.         (fontName notNil) ifTrue: [
  607.             self font: fontName
  608.         ].
  609.         (fontSize notNil) ifTrue: [
  610.             self fontSize: fontSize
  611.         ].
  612.         (typeFace notNil) ifTrue: [
  613.             self typeFace: typeFace
  614.         ].
  615.         self print: text.
  616.         (selectRange notNil) ifTrue: [
  617.             ((selectRange x) ~= (selectRange y)) ifTrue: [
  618.                 self setSelectionRangeFrom: (selectRange x) to: (selectRange y).
  619.                 self scrollToSelection
  620.             ]
  621.         ]
  622. ]
  623.  
  624. Methods SelectListPane 'all'
  625.  
  626.     isTextPane
  627.         ^ false
  628. |
  629.     openOn: aCollection in: aWindow withSizeFrom: topLeft to: bottomRight
  630.         collection <- aCollection.
  631.         self boundsFrom: topLeft to: bottomRight;
  632.              attachTo: aWindow withSizing: (0 @ 0)
  633. |
  634.     attachTo: aWindow withSizing: aPoint
  635.         panePtr <- super attachTo: aWindow withType: 2 andSizing: aPoint
  636. |
  637.     collection: aCollection
  638.         collection <- aCollection
  639. |
  640.     withSelectedItemSend: aSelector to: anObject
  641.     " Send aSelector to anObject, using the selected item as an argument "
  642.     | item a  |
  643.         item <- (collection findText: (self getSelectedKey)).
  644.         item notNil ifTrue: [
  645.             a <- Array new: 2.
  646.             a at: 1 put: anObject; at: 2 put: item.
  647.             smalltalk perform: aSelector withArguments: a
  648.         ]
  649.         ifFalse: [
  650.             ^ nil
  651.         ]
  652. |
  653.     sendToSelectedItem: aSelector
  654.     " Send aSelector to the currently selected item "
  655.     | item a |
  656.         item <- (collection findText: (self getSelectedKey)).
  657.         item notNil ifTrue: [
  658.             a <- Array new: 1.
  659.             a at: 1 put: item.
  660.             smalltalk perform: aSelector withArguments: a
  661.         ]
  662.         ifFalse: [
  663.             ^ nil
  664.         ]
  665. |
  666.     evaluateForSelectedItem: aBlock
  667.     " Evaluate aBlock with the selected item as parameter "
  668.     | item |
  669.         item <- (collection findText: (self getSelectedKey)).
  670.         aBlock value: item
  671. |
  672.     getSelectedKey
  673.     | t |
  674.         " Strip <cr> from selected text and return as a key "
  675.         t <- self selectedText.
  676.         ^ t copyFrom: 1 to: ((t size) - 1).
  677. |
  678.     setText
  679.     " Display the pane's collection as  a selectable list "
  680.         self clearAllText; text: (collection asFormattedText)
  681. |
  682.     text: t
  683.         text <- t.
  684.         self print: text
  685. |
  686.     close
  687.         pMenu dispose
  688. ]
  689.  
  690. Methods GraphicsPane 'all'
  691.     isTextPane
  692.         ^ false
  693. |
  694.     attachTo: aWindow withSizing: aPoint
  695.         panePtr <- super attachTo: aWindow withType: 3 andSizing: aPoint
  696. |
  697.     startDrawing
  698.         <168 4 panePtr>
  699. |
  700.     endDrawing
  701.         <168 5 panePtr>
  702. |
  703.     draw
  704.         " done by subclasses "
  705.         ^ nil
  706. |
  707.     at: x and: y print: text
  708.         <190 x y text>
  709. |
  710.     saveState
  711.         " Should save graphics in some way that allows them to be
  712.           easily restored later "
  713.         ^ nil
  714. |
  715.     restoreState
  716.         " Restore the state of this pane after loading a new image file and 
  717.           re-draw any graphics "
  718.         super restoreState.
  719.         self draw
  720. ]
  721.  
  722. Methods Menu 'all'
  723.     new                "Modified for v3.1.5"
  724.         numItems <- 0.
  725.         items <- Array new: 0.
  726.         itemtitles <- Array new: 0.
  727.         enablestatus <- Array new: 0.
  728.         shortcuts    <- Array new: 0.
  729.         (1 to: 15) do: [:i | (menus at: i) isNil
  730.             ifTrue: [ menus at: i put: self.
  731.                     number <- i.  ^ self ] ]
  732. |
  733.     number
  734.         ^ number
  735. |
  736.     menuPtr
  737.         ^ menuPtr
  738. |
  739.     owner: anObject
  740.     "Added for v3.1.5"
  741.         owner <- anObject
  742. |
  743.     owner
  744.     "Added for v3.1.5"
  745.         ^ owner
  746. |
  747.     addSeparator        "Note: Macintosh specific"
  748.         self addItem: '-' action: [ ^ nil ].
  749.         self disableItem: numItems
  750. |
  751.     addItem: name action: aBlock
  752.         items <- items with: aBlock.
  753.         itemtitles <- itemtitles with: name.
  754.         enablestatus <- enablestatus with: true.
  755.         shortcuts <- shortcuts with: -1.
  756.         <181 menuPtr name nil>.
  757.         numItems <- numItems + 1
  758. |
  759.     addItem: name action: aBlock withShortcut: aCharacter
  760.     "Added for v3.1.5"
  761.         items        <- items with: aBlock.
  762.         itemtitles   <- itemtitles with: name.
  763.         enablestatus <- enablestatus with: true.
  764.         shortcuts    <- shortcuts with: aCharacter.
  765.         <181 menuPtr name (aCharacter asInteger)>.
  766.         numItems <- numItems + 1
  767. |
  768.     removeItem: anItemNumber
  769.     "Modified for v3.1.5"
  770.         (anItemNumber to: (numItems - 1)) do: [:i |     "Shift up array elements to close gap"
  771.             items at: i put: (items at: (i + 1)).
  772.             itemtitles at: i put: (itemtitles at: (i + 1)).
  773.             enablestatus at: i put: (enablestatus at: (i + 1)).
  774.             shortcuts at: i put: (shortcuts at: (i + 1))
  775.         ].
  776.         <184 menuPtr 2 anItemNumber>.
  777.         numItems <- numItems - 1
  778. |
  779.     enableItem: n
  780.         enablestatus at: n put: true.
  781.         <182 menuPtr n 1 1>
  782. |
  783.     disableItem: n
  784.         enablestatus at: n put: false.
  785.         <182 menuPtr n 1 0>
  786. |
  787.     selectItem: n inWindow: w
  788.         " execute the selected menu item "
  789.         (items at: n) value: w
  790. |
  791.     selectItem: n
  792.     | item |
  793.         item <- items at: n.
  794.         (item respondsTo: #blockContext:) ifTrue: [
  795.             item value: nil
  796.         ]
  797.         ifFalse: [
  798.             self performItemAction: item
  799.         ]
  800. |
  801.     performItemAction: action
  802.     "Added for v3.1.5"
  803.     | a |
  804.         a <- Array new: 1.
  805.         a at: 1 put: owner.
  806.         smalltalk perform: action withArguments: a ifError:
  807.             [ smalltalk showMessage: 'Invalid action for selected menu option' ]    
  808. |
  809.     popUpAt: aPoint 
  810.     "Added for v3.1.5"
  811.     | sel item |
  812.     "Display this menu as a pop-up menu at 'aPoint' "
  813.         smalltalk setDefaultCursor.
  814.         sel <- <183 menuPtr (aPoint y) (aPoint x)>.
  815.         (sel ~= 0) ifTrue: [
  816.             self selectItem: sel
  817.         ]
  818. |
  819.     title: aString
  820.         " give the title to a menu item"
  821.         title <- aString
  822. |
  823.     create
  824.         "create menu"
  825.         menuPtr <- <180 number title 0>            "Method changed for v3.1.3"
  826. |
  827.     dispose
  828.         <184 menuPtr 1>
  829. |
  830.     restoreItems
  831.         " Add all the existing items and set status accordingly "
  832.         (1 to: items size) do:
  833.             [:i | <181 menuPtr (itemtitles at: i) nil>.
  834.                 (enablestatus at: i) 
  835.                     ifFalse: [ self disableItem: i]]
  836. |
  837.     restoreState
  838.         " Restore the state of this menu after loading a new image file "
  839.         self create.
  840.         self restoreItems
  841. ]
  842.  
  843. Methods PopUpMenu 'all'
  844.     new                        "Super method overridden for v3.1.3, modified for v3.1.5"
  845.         numItems     <- 0.
  846.         items        <- Array new: 0.
  847.         itemtitles   <- Array new: 0.
  848.         enablestatus <- Array new: 0.
  849.         shortcuts    <- Array new: 0.
  850. |
  851.     create                    "Method changed for v3.1.3"
  852.         "create menu"
  853.         menuPtr <- <180 nextPopMenuNum title 1>.
  854.         number  <- nextPopMenuNum.
  855.         nextPopMenuNum <- nextPopMenuNum + 1.
  856. "|"
  857. ""    "Methods eliminated for v3.1.5 - now inherited"
  858. "    popUpAt: aPoint | sel item |
  859. ""        smalltalk setDefaultCursor.
  860. ""        sel <- <183 menuPtr (aPoint y) (aPoint x)>.
  861. ""        (sel ~= 0) ifTrue: [
  862. ""            item <- items at: sel.
  863. ""            item value
  864. ""        ]
  865. ""
  866. ""|
  867. ""    restoreState
  868. "        " Restore the state of this pop-up menu after loading a new image file "
  869. "        self create.
  870. ""        self restoreItems
  871. "
  872. ]
  873.  
  874. Methods EventManager 'all'
  875.     new
  876.     "Create an array containing methods to be executed on receiving each event"
  877.         responses <- Array new: 24.
  878.         responses at: 1  put: [:w | w activate ].
  879.     " Where key presses are concerned, TextEdit now does the hard work. So, 
  880.       unless anyone has a better idea, we will ignore key presses for now. "
  881.         responses at: 2  put: [:w | w <- nil ].
  882.     "    responses at: 2  put: [:w | w charTyped: (Char new; value: <171 4>) ]."
  883.         responses at: 3  put: [:w | w command: <171 9> ].
  884.         responses at: 4  put: [:w | 
  885.                         w mouseDownAt: self mouseLocation button: (self mouseButton) ].
  886.         responses at: 5  put: [:w | w mouseMoveTo: self mouseLocation ].
  887.         responses at: 6  put: [:w | w mouseUpAt: self mouseLocation ].
  888.         responses at: 7  put: [:w | self eventMenu 
  889.         "    selectItem: self menuItem inWindow: w ]."
  890.             selectItem: self menuItem ].
  891.         responses at: 8  put: [:w | w reSized ].
  892.         responses at: 9  put: [:w | w moved ].
  893.         responses at: 10 put: [:w | smalltalk updateWindows ].
  894.         self newPartTwo
  895. |
  896.     newPartTwo
  897.     "Continuation of the above method due to limits on bytecode array sizes"
  898.         responses at: 11 put: [:w | scheduler quit ].            "Was timer event"
  899.         responses at: 12 put: [:w | w deactivate ].
  900.         responses at: 13 put: [:w | smalltalk processEvent ].   "Externally generated event (AppleEvent)"
  901.         responses at: 14 put: [:w | w deactivate ].  "Non-ASCII key event"
  902.         responses at: 15 put: [:w | w deactivate ].  "Lost selection"
  903.         responses at: 16 put: [:w | w close ]
  904. |
  905.     eventWindow | w |                "Which window is event from?"
  906.     
  907.         "Changed to allow for legitimate cases when window is not"
  908.         "found (e.g. menu selection made with no open windows or a window"
  909.         "has been selected that is not ours"
  910.         
  911.         w <- <171 1>.                            
  912.         (w = 0) ifTrue: [
  913.             ^ 0
  914.         ]
  915.         ifFalse: [    
  916.             ^ windows at: w
  917.         ]    
  918. |
  919.     eventMenu | m |
  920.         ^ menus at: <171 2>.            "Which menu is event from?"
  921. |
  922.     menuItem
  923.         ^ <171 3>
  924. |
  925.     mouseLocation
  926.         " return the current location of the mouse "
  927.         ^ <172 1>
  928. |
  929.     mouseButton
  930.         " Return the number of the mouse button pressed "
  931.         ^ <171 6>
  932. |
  933.     mouseClicks
  934.         " Return the number of clicks of the mouse button - added for v3.1.2"
  935.         ^ <171 7>.
  936. |
  937.     isDoubleClick
  938.         " Return true if a double click has been detected - added for v3.1.2"
  939.         ^ (self mouseClicks = 2)
  940. |
  941.     execute        | i w |
  942.         " process one event "
  943.         i <- <170>. (i = 0) 
  944.         ifFalse: [             "Changed to allow for eventWindow returning zero"
  945.             w <- self eventWindow.
  946.             activeWindow <- w.
  947.             (w = 0) ifTrue: [ 
  948.                 (i = 11) ifTrue: [    "Trap quit command"
  949.                     (responses at: i) value: nil         
  950.                 ].
  951.                 (i = 7) ifTrue: [    "Trap menu selection with no open windows"
  952.                     (responses at: i) value: nil         
  953.                 ]                    "Other possibility is that window is not ours"
  954.             ]                         " so we ignore it"
  955.             ifFalse: [
  956.                 (responses at: i) value: self eventWindow 
  957.             ]
  958.         ]
  959. ]
  960. *
  961. * Following class extensively modified for v3.1.5
  962. *
  963. Methods UserInterface 'all'
  964.     browseClasses
  965.     | b |
  966.         b <- Browser new; open.
  967. |
  968.     interpretFile
  969.     | f |
  970.         f <- (smalltalk askFile: 'file name:').
  971.         (f notNil) ifTrue: [
  972.             smalltalk interpretFile: f
  973.         ]
  974. |
  975.     saveImage
  976.     | f |
  977.         [
  978.             windows do: [:w | 
  979.                 w notNil ifTrue: [ w saveState ]
  980.             ].
  981.             f <- (smalltalk askNewFile: 'Image file:').
  982.             watchCursor show.
  983.             smalltalk saveImage: f; setDefaultCursor
  984.         ] fork
  985. |
  986.     saveText
  987.     | fname pane |
  988.         pane  <- activeWindow mainPane.
  989.         fname <- pane file.
  990.         fname isNil ifTrue: [
  991.             self saveTextAs
  992.         ]
  993.         ifFalse: [
  994.             pane saveContentsTo: fname withType: 1
  995.         ]
  996. |
  997.     saveTextAs
  998.     | fname |
  999.         fname <- smalltalk askNewFile: 'Text file:'.
  1000.         (fname notNil) ifTrue: [
  1001.             activeWindow mainPane saveContentsTo: fname withType: 1
  1002.         ]
  1003. |
  1004.     openTextFile
  1005.     | fname |
  1006.         fname <- smalltalk askFile: 'Text file:' withFilter: 1.
  1007.         (fname notNil) ifTrue: [
  1008.             self openNamedTextFile: fname
  1009.         ]
  1010. |
  1011.     printIt
  1012.     | p sel |
  1013.         [
  1014.             p <- activeWindow mainPane.
  1015.             sel <- p getSelectionRange.
  1016.             p print: (p selectedText value asString) , newLine.
  1017.             p setSelectionRangeFrom: (sel y) to: 32767
  1018.         ] fork
  1019. |
  1020.     doIt
  1021.         [
  1022.             activeWindow mainPane selectedText execute
  1023.         ] fork
  1024. |
  1025.     inspectIt
  1026.         ((activeWindow mainPane) selectedText , ' inspect') execute
  1027. |
  1028.     newWorkspace
  1029.         WorkspaceWindow new; create
  1030. |
  1031.     openNamedTextFile: fname
  1032.     | ws |
  1033.         ws <- WorkspaceWindow new; create: (smalltalk trimFileName: fname).
  1034.         (ws mainPane) loadContentsFrom: fname
  1035. |
  1036.     makeSystemMenu                    " Changed for v3.1.5"
  1037.         systemMenu isNil ifTrue: [ 
  1038.             systemMenu <- Menu new; title: 'System'; owner: self; create.
  1039.             systemMenu 
  1040.                 addItem: 'Browser' 
  1041.                     action: #browseClasses 
  1042.                     withShortcut: $B;
  1043.                 addSeparator;
  1044.                 addItem: 'Interpret File...' 
  1045.                     action: #interpretFile;
  1046.                 addItem: 'Save image...'     
  1047.                     action: #saveImage;
  1048.                 addSeparator;
  1049.                 addItem: 'Save'    
  1050.                     action: #saveText 
  1051.                     withShortcut: $S;
  1052.                 addItem: 'Save As...'   
  1053.                     action: #saveTextAs;
  1054.                 addItem: 'Open Text...' 
  1055.                     action: #openTextFile  withShortcut: $O;
  1056.                 addSeparator;
  1057.                 addItem: 'Print It'
  1058.                     action: #printIt
  1059.                     withShortcut: $P;
  1060.                 addItem: 'Do It'
  1061.                     action: #doIt
  1062.                     withShortcut: $D;
  1063.                 addItem: 'Inspect It'
  1064.                     action: #inspectIt
  1065.                     withShortcut: $I;
  1066.                 addSeparator;
  1067.                 addItem: 'New Workspace'
  1068.                     action: #newWorkspace
  1069.                     withShortcut: $N
  1070.         ].
  1071. |
  1072.     makeWindowsMenu
  1073.         windowsMenu    <- Menu new; title: 'Windows'; create.
  1074.         nextItemNumber <- 0.
  1075.         itemList       <- Array new: 15
  1076. |
  1077.     addToWindowsMenu: aWindow
  1078.         (nextItemNumber == 0) ifFalse: [
  1079.             ((itemList at: nextItemNumber) == aWindow) ifTrue: [
  1080.                 ^ nil                             " Already there..."
  1081.             ]
  1082.         ].
  1083.         windowsMenu addItem: (aWindow title) 
  1084.             action: [:w | (itemList at: (eventManager menuItem)) select ].
  1085.         nextItemNumber <- nextItemNumber + 1.
  1086.         itemList at: nextItemNumber put: aWindow.
  1087.         self checkSystemMenu
  1088. |
  1089.     removeFromWindowsMenu: aWindow    | wmi |
  1090.         (1 to: nextItemNumber) do: [ :i |        "Find the window in the list"
  1091.             ((itemList at: i) == aWindow) ifTrue: [
  1092.                 wmi <- i
  1093.             ]
  1094.         ].
  1095.         windowsMenu removeItem: wmi.
  1096.         (wmi to: nextItemNumber - 1) do: [:i |     "Shift up array elements to close gap"
  1097.             itemList at: i put: (itemList at: (i + 1))
  1098.         ].
  1099.         nextItemNumber <- nextItemNumber - 1.
  1100.         self checkSystemMenu
  1101. |
  1102.     makeWorkspace " Functionality moved to class WorkspaceWindow - v3.1.2 "
  1103.         workspace <- WorkspaceWindow new.
  1104.         workspace attachMenu: systemMenu; attachMenu: windowsMenu.
  1105.         systemMenu disableItem: 12.
  1106. |
  1107.     saveWorkspace " Added for v3.1.2 "
  1108.         saveWS    <- workspace.
  1109.         workspace <- nil.
  1110.         printer   <- nil.
  1111. |
  1112.     restoreWorkspace " Added for v3.1.2 "
  1113.         workspace <- saveWS.
  1114.         workspace restoreWorkspace.
  1115.         printer <- workspace mainPane.
  1116. |
  1117.     makeTranscript
  1118.         systemTranscript <- SystemTranscriptWindow new; 
  1119.                                 create;
  1120.                                 attachMenu: systemMenu; 
  1121.                                 attachMenu: windowsMenu.
  1122. |
  1123.     checkSystemMenu
  1124.     " Disable certain menu items when there are no windows open. Enable
  1125.       them when there are. Invoked whenever windows are opened or closed.
  1126.       - added for v3.1.1"
  1127.         ^ nil.                " No longer needed as of v3.1.5"
  1128.         
  1129.         (nextItemNumber = 0) ifTrue: [
  1130.             systemMenu  disableItem: 6;
  1131.                          disableItem: 7;
  1132.                          disableItem: 9;
  1133.                          disableItem: 10;
  1134.                         enableItem:  12
  1135.         ]
  1136.         ifFalse: [
  1137.             systemMenu  enableItem:  6;
  1138.                         enableItem:  7;
  1139.                         enableItem:  9;
  1140.                         enableItem:  10.
  1141.             workspace isNil ifTrue: [
  1142.                 systemMenu enableItem: 12
  1143.             ]
  1144.             ifFalse: [
  1145.                 systemMenu disableItem: 12
  1146.             ]
  1147.         ]
  1148. ]
  1149.  
  1150. Methods Smalltalk 'doit'
  1151.     error: aString    | ew |
  1152.         " print a message, and remove current process "
  1153.         " scheduler currentProcess trace. "
  1154.         self showMessage: aString.
  1155.         (scheduler currentProcess) terminate
  1156. ]
  1157.  
  1158. Methods Scheduler 'get commands'
  1159.     initialize
  1160.     "Modified for v3.1.5"
  1161.         (systemTranscript isNil) ifTrue: [
  1162.             watchCursor fetchNamedCursor: 'watch'.
  1163.             userInterface makeSystemMenu.
  1164.             userInterface makeWindowsMenu.
  1165.             userInterface makeTranscript
  1166.         ].
  1167.         printer      <- systemTranscript mainPane.
  1168.         eventManager <- EventManager new.
  1169.         scheduler addProcess: eventManager
  1170. |
  1171.     quit
  1172.         " all done - really quit "
  1173.         " should probably verify first "
  1174.         notdone <- false
  1175. ]
  1176. *
  1177. * initialization code
  1178. * this is executed once, by the initial image maker
  1179. *
  1180. *
  1181. Methods UndefinedObject 'initial image'
  1182.     createGlobals
  1183.         " create global variables in initial image "
  1184.         true      <- True new.
  1185.         false     <- False new.
  1186.         smalltalk <- Smalltalk new.
  1187.         files     <- Array new: 15.
  1188.         classes   <- Dictionary new.        " create a dictionary of classes "
  1189.         symbols binaryDo: [:x :y | 
  1190.             (y class == Class)
  1191.                 ifTrue: [ classes at: x put: y ] ].
  1192.         self createGlobalsPart2
  1193. |
  1194.     createGlobalsPart2
  1195.         printer         <- nil.
  1196.         windows         <- Array new: 15.
  1197.         menus           <- Array new: 15.
  1198.         scheduler       <- Scheduler new.
  1199.         userInterface   <- UserInterface new.
  1200.         eventManager    <- nil.
  1201.     "    workspace       <- nil." "Removed for v3.1.5"
  1202.         systemTranscript <- nil.
  1203.         activeWindow    <- nil.
  1204.         nextBrowserNum  <- 1.
  1205.         nextWkSpaceNum  <- 1.
  1206.         newLine         <- 13 asCharacter.
  1207.         watchCursor     <- Cursor new.
  1208.         systemMenu        <- nil.
  1209.         windowsMenu     <- nil. 
  1210.         activeWindow    <- nil.
  1211.         nextPopMenuNum  <- 0                "Global added for v3.1.3"
  1212. |
  1213.     initialize    | aBlock |
  1214.         " initialize the initial object image "
  1215.         self createGlobals.
  1216.         " create the initial system process "
  1217.         " note the delayed recursive call "
  1218.         aBlock <- [ files do: [:f | f notNil ifTrue: [ f open ]].
  1219.                 menus do: [:m | m notNil ifTrue: [ m restoreState ]].
  1220.                 windows do: [:w | w notNil ifTrue: [ w restoreState ]].
  1221.                 systemProcess <- aBlock newProcess.
  1222.                 scheduler run ].
  1223.         systemProcess <- aBlock newProcess.
  1224.         File new;
  1225.             name: 'systemImage';
  1226.             open: 'wb' withType: 2;
  1227.             saveImage;
  1228.             close
  1229. ]
  1230.  
  1231. Methods String 'test'
  1232.     print
  1233.         ^ printer print: self
  1234. ]
  1235.  
  1236. Methods Smalltalk 'interface'
  1237.     getVersion                            "Added for v3.1.3"
  1238.         ^ <254>
  1239. |
  1240.     showMessage: aString                "Added for v3.1.2"
  1241.         ^ <204 aString>
  1242. |
  1243.     getPrompt: aString
  1244.         ^ <201 aString ''>
  1245. |
  1246.     askNewFile: prompt
  1247.         " ask for a new file name "
  1248.         ^ <203 prompt '' 1 0>
  1249. |    
  1250.     askFile: prompt
  1251.         "ask for a file name but don't filter out unwanted file types"
  1252.         ^ <203 prompt '' 0 0>
  1253. |
  1254.     askFile: prompt    withFilter: filter    | i |
  1255.         "ask for a file name, filtering out all types but 'filter'. Filter
  1256.          should be 1 or 2 according to the three available file types: 
  1257.              1 - Text (including saved workspaces)
  1258.              2 - System Image "
  1259.         ^ <203 prompt '' 0 filter>
  1260. |
  1261.     inquire: aString
  1262.         ^ <202 aString 1>
  1263. |
  1264.     updateWindows            "Re-draw all windows"
  1265.         windows do: [ :win |
  1266.             (win notNil)
  1267.             ifTrue: [
  1268.                 win drawEvent
  1269.             ]
  1270.         ]
  1271. |
  1272.     updateClassDictionary
  1273.     " Update the class dictionary. It's a bit wasteful 
  1274.       creating a new Dictionary object every time, but
  1275.       the alternative is to check each class to see if
  1276.       it's new or not...."
  1277.         classes <- Dictionary new.
  1278.         symbols binaryDo: [:x :y | 
  1279.             (y class == Class) ifTrue: [ 
  1280.                 classes at: x put: y 
  1281.             ] 
  1282.         ]
  1283. |
  1284.     getMaxScreenArea        "Return a rect representing the max available screen area"
  1285.         ^ <167>
  1286. |
  1287. "
  1288.   processEvent: Process externally generated events 
  1289.   - only event for now is Open Document so we do no event type checks.
  1290. "
  1291.     processEvent    | fullPath ft  mp |            "Changed for v3.1.3"    
  1292.         fullPath <- <207>.        " Get info from event - a file type and a full path "
  1293.         (fullPath notNil) ifTrue: [
  1294.             ft       <- (fullPath copyFrom: 1 to: 1) asInteger.
  1295.             fullPath <- fullPath copyFrom: 2 to: (fullPath size).
  1296.             (ft = 2) ifTrue: [
  1297.                 self showMessage: 
  1298.                 'Cannot load new System Image whilst application is still running'
  1299.             ]
  1300.             ifFalse: [
  1301.                 self processDroppedFile: fullPath
  1302.             ]
  1303.         ]
  1304. |
  1305.     processDroppedFile: fullPath | s |            "Method added for v3.1.3, modified for v3.1.5"
  1306.         s <- fullPath copyFrom: ((fullPath size) - 2) to: (fullPath size).
  1307.         (s = '.st') ifTrue: [
  1308.             self interpretFile: fullPath.
  1309.             ^ nil
  1310.         ]
  1311.         ifFalse: [
  1312.             userInterface openNamedTextFile: fullPath
  1313.         ].
  1314.         ^ nil
  1315. |
  1316.     interpretFile: aFileName                    "Method added for v3.1.3"
  1317.         watchCursor show.
  1318.         File new; fileIn: aFileName.
  1319.         self updateClassDictionary; setDefaultCursor
  1320. |
  1321.     trimFileName: aFileName                        "Method added for v3.1.5 - Mac specific!!!!"
  1322.     "Trim path info from fully qualified filename"
  1323.     | a |
  1324.         a <- (aFileName words: [:x | x ~= $: ]).
  1325.         ^ a at: (a size)
  1326. ]
  1327.  
  1328. Methods Point 'drawing'
  1329.     moveTo
  1330.         <192 2 (self x) (self y)>
  1331. |
  1332.     drawPixel
  1333.         <192 3 (self x) (self y)>
  1334. |
  1335.     lineTo
  1336.         <192 1 (self x) (self y)>
  1337. ]
  1338.  
  1339. Methods Rectangle 'drawing'
  1340.     frame
  1341.         <194 1 left top right bottom>
  1342. |
  1343.     paint
  1344.         <194 2 left top right bottom>
  1345. |
  1346.     erase
  1347.         <194 3 left top right bottom>
  1348. |
  1349.     invert
  1350.         <194 4 left top right bottom>
  1351. |
  1352.     shade: aPercent
  1353.         <195 1 left top right bottom aPercent>
  1354. ]
  1355.  
  1356. Methods Smalltalk 'beep'
  1357.     beep
  1358.         <205>
  1359. ]
  1360.  
  1361. Methods Circle 'drawing'
  1362.     frame
  1363.         <193 1 (center x) (center y) radius>
  1364. ]
  1365.  
  1366. Methods Cursor 'all'
  1367.     "
  1368.     The valid cursor names are:
  1369.         ibeam      - standard text-editing cursor
  1370.         cross      - cross-hairs
  1371.         plus       - blocky '+' sign
  1372.         watch      - standard 'busy' cursor
  1373.         arrow      - default
  1374.         ClosedHand - a closed hand
  1375.         OpenHand   - an open hand 'dragging' cursor
  1376.         Pen        - a pen symbol
  1377.     The last three are defined in the resource fork. Extra cursors maybe added
  1378.     to the resource file and referenced by name in the same way.
  1379.     "
  1380.     fetchNamedCursor: aCursorName
  1381.         cursPtr <- <164 1 aCursorName>
  1382. |
  1383.     show
  1384.         <164 2 cursPtr>
  1385. ]
  1386.  
  1387. Methods Smalltalk 'cursor'
  1388.     setDefaultCursor
  1389.         <164 3>
  1390. ]
  1391.